/**
 * Copyright (c) 2020 kedacom
 * OpenATC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 * http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 **/
import Authapi from './authapi'

class Route {
  getSimpleArea = () => {
    let api = new Authapi('getSimpleRoute')
    return api.Send({}, {}, [])
  }
  getAllArea = () => {
    let api = new Authapi('getAllArea')
    return api.Send({}, {}, [])
  }
  getSingleArea = (id) => {
    let api = new Authapi('getSingleArea')
    let paramList = [id]
    return api.Send({}, {}, paramList)
  }
  addArea = (data) => {
    let api = new Authapi('addArea')
    const params = JSON.parse(JSON.stringify(data))
    return api.Send({}, params, [])
  }
  updateAreaName = (data) => {
    let api = new Authapi('updateAreaName')
    const params = JSON.parse(JSON.stringify(data))
    return api.Send({}, params, [])
  }
  updateAreaStrategy = (data) => {
    let api = new Authapi('updateAreaStrategy')
    const params = JSON.parse(JSON.stringify(data))
    return api.Send({}, params, [])
  }
  updateAreaDevs = (data) => {
    let api = new Authapi('updateAreaDevs')
    const params = data.list
    let paramList = [data.id]
    return api.Send({}, params, paramList)
  }
  updateAreaRoutes = (data) => {
    let api = new Authapi('updateAreaRoutes')
    const params = data.list
    let paramList = [data.id]
    return api.Send({}, params, paramList)
  }
  deleteArea = (id) => {
    let api = new Authapi('deleteArea')
    let paramList = [id]
    return api.Send({}, {}, paramList)
  }
  uploadAreaPattern = (id) => {
    let api = new Authapi('uploadAreaPattern')
    let paramList = [id]
    return api.Send({}, {}, paramList)
  }
  uploadAreaPhase = (id) => {
    let api = new Authapi('uploadAreaPhase')
    let paramList = [id]
    return api.Send({}, {}, paramList)
  }
  downloadAreaRoutes = (data) => {
    let api = new Authapi('downloadAreaRoutes')
    const params = JSON.parse(JSON.stringify(data))
    return api.Send({}, params, [])
  }
  generateAreaSubzone = (id) => {
    let api = new Authapi('generateAreaSubzone')
    return api.Send({}, id, [])
  }
  generateAreaPattern = (id) => {
    let api = new Authapi('generateAreaPattern')
    return api.Send({}, id, [])
  }
}
const route = new Route()
export default route
